package com.yq.order.ocr;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yinqi on 2018/9/1.
 */
public class OcrPresenter {
    HashMap<String, String> options = new HashMap<String, String>();

    public String getOcrResult(String path) {
        JSONObject res = AipOcrManager.getAipOcrInstance().basicAccurateGeneral(path, getOptionMap());
        System.out.println(res.toString(2));
        return res.toString(2);
    }

    private HashMap<String, String> getOptionMap() {
        if (null == options) {
            options = new HashMap<String, String>();
            // 传入可选参数调用接口
            options.put("language_type", "CHN_ENG");
//            options.put("detect_direction", "true");
//            options.put("detect_language", "true");
//            options.put("probability", "true");
        }
        return options;
    }
}
